<script>
function assignTeam(id,cabinetId){
                
        $(function() {	
           
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $( "#assign-team-form" ).dialog({
                resizable: false,
                width:400,
                modal: true,
                buttons: {
                    "Save": function() {
                        var selectedUsers = $("#teamMembers").val() || [];
                        $.ajax({
                            type: "POST",
                            url: "<?= $this->baseURI(); ?>street/notification/add/"+id, 
                            data:({team:selectedUsers.join(",")}),
                            success: function(msg){
                                $("#street-list").load("<?= $this->baseURI(); ?>street/notification/list/"+cabinetId);
                            }
                        }); 
                        $( this ).dialog( "close" );
                    },
                    Cancel: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
            $("#assign-team-form").load("<?= $this->baseURI(); ?>street/notification/add/"+id);
        });
    }
     $(function() {
        $( "#dialog:ui-dialog" ).dialog( "destroy" );

        function updateTips( t ) {
            tips = $( ".validateTips" );
            tips
            .text( t )
            .addClass( "ui-state-highlight" );
            setTimeout(function() {
                tips.removeClass( "ui-state-highlight", 1500 );
            }, 500 );
        }

        function checkLength( o, n, min, max ) {

            if ( o.val().length > max || o.val().length < min ) {
                o.addClass( "ui-state-error" );
                updateTips( "Length of " + n + " must be between " +
                    min + " and " + max + "." );
                return false;
            } else {
                return true;
            }
        }

        $( "#add-document-form" ).dialog({
            autoOpen: false,
            width: 450,
            modal: true,
            buttons: {
                "Add": function() {
                    $('#document_form').submit();
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                    $('#add-document-form').html('');
                }
            },
            close: function() {
                $('#add-document-form').html('');
                //   allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });
        
    });
</script>
<div class="dataBoxOver">
    <div class="dataInnRep">
        <div class="dataInnTop" id="cabinet-listing">
            <div class="dataInnBottom">

                <div class="dataHeader">
                    <h4>Notification</h4>
                </div>
                <div class="clr"></div>
                <div class="add-button">        
                    <?php echo $this->form->cabinetlist; ?>
                </div>
                <?php echo $this->render('notification/list.phtml'); ?>	
            </div>	
        </div>
    </div>
</div>
<div id="assign-team-form" title="Assign Team"></div>
<div id="add-document-form" title="Add document"></div>